#!/bin/sh
#
# remake the pcp-mpstat archive ...
# this archive is intended to be checked in and not remade, this script is
# simply a record of how it was created
#

. /etc/pcp.env

tmp=/var/tmp/$$
rm -f $tmp.*
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15

cat <<End-of-File >>$tmp.config
log advisory on once{
        kernel.uname.sysname
        kernel.uname.release
        kernel.uname.nodename
        kernel.uname.machine
        hinv.ncpu
}
log advisory on 10 seconds {
                hinv.map.cpu_num
                hinv.cpu.online
                kernel.all.cpu.vuser
                kernel.all.cpu.vnice
                kernel.all.cpu.sys
                kernel.all.cpu.wait.total
                kernel.all.cpu.irq.hard
                kernel.all.cpu.irq.soft
                kernel.all.cpu.steal
                kernel.all.cpu.guest
                kernel.all.cpu.guest_nice
                kernel.all.cpu.idle
                kernel.percpu.cpu.vuser
                kernel.percpu.cpu.vnice
                kernel.percpu.cpu.sys
                kernel.percpu.cpu.wait.total
                kernel.percpu.cpu.irq.hard
                kernel.percpu.cpu.irq.soft
                kernel.percpu.cpu.steal
                kernel.percpu.cpu.guest
                kernel.percpu.cpu.guest_nice
                kernel.percpu.cpu.idle
                kernel.all.intr
                kernel.percpu.intr
}
End-of-File

base=pcp-mpstat

rm -f $base.*

if pmlogger -T 60sec -t 10sec -c $tmp.config $base; then
        xz $base.0
        xz $base.index
        xz $base.meta
else
    echo "Argh: pmlogger failed ..."
    cat pmlogger.log
fi




